<!DOCTYPE html>
<html lang="zh-Hans">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<meta name="theme-color" content="#222"><meta name="generator" content="Hexo 6.2.0">


  <link rel="apple-touch-icon" sizes="180x180" href="/vhuichen.ico">
  <link rel="icon" type="image/png" sizes="32x32" href="/vhuichen.ico">
  <link rel="icon" type="image/png" sizes="16x16" href="/vhuichen.ico">
  <link rel="mask-icon" href="/vhuichen.ico" color="#222">

<link rel="stylesheet" href="/css/main.css">



<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/css/all.min.css" integrity="sha256-AbA177XfpSnFEvgpYu1jMygiLabzPCJCRIBtR5jGc0k=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.1.1/animate.min.css" integrity="sha256-PR7ttpcvz8qrF57fur/yAx1qXMFJeJFiA6pSzWi0OIE=" crossorigin="anonymous">

<script class="next-config" data-name="main" type="application/json">{"hostname":"vhuichen.github.io","root":"/","images":"/images","scheme":"Pisces","darkmode":false,"version":"8.13.0","exturl":false,"sidebar":{"position":"left","display":"display","padding":18,"offset":12},"copycode":{"enable":false,"style":null},"bookmark":{"enable":false,"color":"#222","save":"auto"},"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"stickytabs":false,"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"prism":false,"i18n":{"placeholder":"Searching...","empty":"We didn't find any results for the search: ${query}","hits_time":"${hits} results found in ${time} ms","hits":"${hits} results found"}}</script><script src="/js/config.js"></script>

    <meta name="description" content="前言学习下怎样将自己的代码上传到CocoaPods 1.在GitHub上创建新的仓库，并clone到本地此时将库文件但放到一个单独的文件夹内，并将相关的演示Demo写好。 2.创建podspec文件12cd path****pod spec create VCHKit  3.修改podspec文件1234567891011121314s.name         &#x3D; &quot;VCHKit&amp;qu">
<meta property="og:type" content="article">
<meta property="og:title" content="iOS开发之上传代码到CocoaPods">
<meta property="og:url" content="https://vhuichen.github.io/2017/06/2017/06/iOS%E5%BC%80%E5%8F%91%E4%B9%8B%E4%B8%8A%E4%BC%A0%E4%BB%A3%E7%A0%81%E5%88%B0CocoaPods/index.html">
<meta property="og:site_name" content="vhuichen">
<meta property="og:description" content="前言学习下怎样将自己的代码上传到CocoaPods 1.在GitHub上创建新的仓库，并clone到本地此时将库文件但放到一个单独的文件夹内，并将相关的演示Demo写好。 2.创建podspec文件12cd path****pod spec create VCHKit  3.修改podspec文件1234567891011121314s.name         &#x3D; &quot;VCHKit&amp;qu">
<meta property="og:locale">
<meta property="article:published_time" content="2017-06-26T11:54:23.000Z">
<meta property="article:modified_time" content="2018-07-01T08:07:17.849Z">
<meta property="article:author" content="vhuichen">
<meta property="article:tag" content="CocoaPods">
<meta name="twitter:card" content="summary">


<link rel="canonical" href="https://vhuichen.github.io/2017/06/2017/06/iOS%E5%BC%80%E5%8F%91%E4%B9%8B%E4%B8%8A%E4%BC%A0%E4%BB%A3%E7%A0%81%E5%88%B0CocoaPods/">



<script class="next-config" data-name="page" type="application/json">{"sidebar":"","isHome":false,"isPost":true,"lang":"zh-Hans","comments":true,"permalink":"https://vhuichen.github.io/2017/06/2017/06/iOS%E5%BC%80%E5%8F%91%E4%B9%8B%E4%B8%8A%E4%BC%A0%E4%BB%A3%E7%A0%81%E5%88%B0CocoaPods/","path":"2017/06/2017/06/iOS开发之上传代码到CocoaPods/","title":"iOS开发之上传代码到CocoaPods"}</script>

<script class="next-config" data-name="calendar" type="application/json">""</script>
<title>iOS开发之上传代码到CocoaPods | vhuichen</title>
  






  <noscript>
    <link rel="stylesheet" href="/css/noscript.css">
  </noscript>
</head>

<body itemscope itemtype="http://schema.org/WebPage" class="use-motion">
  <div class="headband"></div>

  <main class="main">
    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="Toggle navigation bar" role="button">
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <i class="logo-line"></i>
      <p class="site-title">vhuichen</p>
      <i class="logo-line"></i>
    </a>
      <p class="site-subtitle" itemprop="description">记录、分享</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
    </div>
  </div>
</div>



<nav class="site-nav">
  <ul class="main-menu menu"><li class="menu-item menu-item-home"><a href="/" rel="section">Home</a></li><li class="menu-item menu-item-archives"><a href="/archives/" rel="section">Archives</a></li><li class="menu-item menu-item-about"><a href="/about/" rel="section">About</a></li>
  </ul>
</nav>




</div>
        
  
  <div class="toggle sidebar-toggle" role="button">
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
  </div>

  <aside class="sidebar">

    <div class="sidebar-inner sidebar-nav-active sidebar-toc-active">
      <ul class="sidebar-nav">
        <li class="sidebar-nav-toc">
          Table of Contents
        </li>
        <li class="sidebar-nav-overview">
          Overview
        </li>
      </ul>

      <div class="sidebar-panel-container">
        <!--noindex-->
        <div class="post-toc-wrap sidebar-panel">
            <div class="post-toc animated"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#%E5%89%8D%E8%A8%80"><span class="nav-number">1.</span> <span class="nav-text">前言</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#1-%E5%9C%A8GitHub%E4%B8%8A%E5%88%9B%E5%BB%BA%E6%96%B0%E7%9A%84%E4%BB%93%E5%BA%93%EF%BC%8C%E5%B9%B6clone%E5%88%B0%E6%9C%AC%E5%9C%B0"><span class="nav-number">1.1.</span> <span class="nav-text">1.在GitHub上创建新的仓库，并clone到本地</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-%E5%88%9B%E5%BB%BApodspec%E6%96%87%E4%BB%B6"><span class="nav-number">1.2.</span> <span class="nav-text">2.创建podspec文件</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-%E4%BF%AE%E6%94%B9podspec%E6%96%87%E4%BB%B6"><span class="nav-number">1.3.</span> <span class="nav-text">3.修改podspec文件</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#%E9%AA%8C%E8%AF%81pod"><span class="nav-number">1.3.1.</span> <span class="nav-text">验证pod</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#4-%E6%8F%90%E4%BA%A4%E5%BA%93%E5%88%B0CocoaPods-trunk"><span class="nav-number">1.4.</span> <span class="nav-text">4.提交库到CocoaPods trunk</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%A6%82%E6%9E%9C%E6%B2%A1%E6%9C%89%E6%B3%A8%E5%86%8C%EF%BC%8C%E5%88%99%E5%85%88%E6%B3%A8%E5%86%8Ctrunk"><span class="nav-number">1.4.1.</span> <span class="nav-text">如果没有注册，则先注册trunk</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%90%91trunk%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%9F%A5%E8%AF%A2%E8%87%AA%E5%B7%B1%E7%9A%84%E6%B3%A8%E5%86%8C%E4%BF%A1%E6%81%AF"><span class="nav-number">1.4.2.</span> <span class="nav-text">向trunk服务器查询自己的注册信息</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E6%89%93%E4%B8%8A%E5%92%8CGitHub%E4%B8%8A%E7%9B%B8%E5%90%8C%E7%9A%84tag"><span class="nav-number">1.4.3.</span> <span class="nav-text">打上和GitHub上相同的tag</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#5-%E6%8F%90%E4%BA%A4%E4%BB%A3%E7%A0%81%E5%88%B0GitHub"><span class="nav-number">1.5.</span> <span class="nav-text">5.提交代码到GitHub</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#6-%E4%B8%8A%E4%BC%A0%E6%88%96%E6%9B%B4%E6%96%B0trunk"><span class="nav-number">1.6.</span> <span class="nav-text">6.上传或更新trunk</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#7-%E5%87%BA%E7%8E%B0%E7%9A%84%E9%97%AE%E9%A2%98"><span class="nav-number">1.7.</span> <span class="nav-text">7.出现的问题</span></a></li></ol></li></ol></div>
        </div>
        <!--/noindex-->

        <div class="site-overview-wrap sidebar-panel">
          <div class="site-author site-overview-item animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="vhuichen"
      src="/images/vhuichen.jpg">
  <p class="site-author-name" itemprop="name">vhuichen</p>
  <div class="site-description" itemprop="description"></div>
</div>
<div class="site-state-wrap site-overview-item animated">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
        <a href="/archives/">
          <span class="site-state-item-count">78</span>
          <span class="site-state-item-name">posts</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
          <a href="/categories/">
        <span class="site-state-item-count">11</span>
        <span class="site-state-item-name">categories</span></a>
      </div>
      <div class="site-state-item site-state-tags">
          <a href="/tags/">
        <span class="site-state-item-count">86</span>
        <span class="site-state-item-name">tags</span></a>
      </div>
  </nav>
</div>



        </div>
      </div>
    </div>
  </aside>
  <div class="sidebar-dimmer"></div>


    </header>

    
  <div class="back-to-top" role="button" aria-label="Back to top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>

<noscript>
  <div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
</noscript>


    <div class="main-inner post posts-expand">


  


<div class="post-block">
  
  

  <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-Hans">
    <link itemprop="mainEntityOfPage" href="https://vhuichen.github.io/2017/06/2017/06/iOS%E5%BC%80%E5%8F%91%E4%B9%8B%E4%B8%8A%E4%BC%A0%E4%BB%A3%E7%A0%81%E5%88%B0CocoaPods/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/vhuichen.jpg">
      <meta itemprop="name" content="vhuichen">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="vhuichen">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="post" itemscope itemtype="http://schema.org/CreativeWork">
      <meta itemprop="name" content="iOS开发之上传代码到CocoaPods | vhuichen">
      <meta itemprop="description" content="">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          iOS开发之上传代码到CocoaPods
        </h1>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">Posted on</span>

      <time title="Created: 2017-06-26 19:54:23" itemprop="dateCreated datePublished" datetime="2017-06-26T19:54:23+08:00">2017-06-26</time>
    </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar-check"></i>
      </span>
      <span class="post-meta-item-text">Edited on</span>
      <time title="Modified: 2018-07-01 16:07:17" itemprop="dateModified" datetime="2018-07-01T16:07:17+08:00">2018-07-01</time>
    </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-folder"></i>
      </span>
      <span class="post-meta-item-text">In</span>
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/iOS%E5%BC%80%E5%8F%91/" itemprop="url" rel="index"><span itemprop="name">iOS开发</span></a>
        </span>
    </span>

  
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">
        <h1 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h1><p>学习下怎样将自己的代码上传到CocoaPods</p>
<h2 id="1-在GitHub上创建新的仓库，并clone到本地"><a href="#1-在GitHub上创建新的仓库，并clone到本地" class="headerlink" title="1.在GitHub上创建新的仓库，并clone到本地"></a>1.在GitHub上创建新的仓库，并clone到本地</h2><p>此时将库文件但放到一个单独的文件夹内，并将相关的演示Demo写好。</p>
<h2 id="2-创建podspec文件"><a href="#2-创建podspec文件" class="headerlink" title="2.创建podspec文件"></a>2.创建podspec文件</h2><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">cd path****</span><br><span class="line">pod spec create VCHKit</span><br></pre></td></tr></table></figure>

<h2 id="3-修改podspec文件"><a href="#3-修改podspec文件" class="headerlink" title="3.修改podspec文件"></a>3.修改podspec文件</h2><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">s.name         = &quot;VCHKit&quot;</span><br><span class="line">s.version      = &quot;0.0.1&quot;</span><br><span class="line">s.summary      = &quot;this is summary&quot;</span><br><span class="line">s.description  = &lt;&lt;-DESC</span><br><span class="line">                 this is description</span><br><span class="line">                 DESC</span><br><span class="line">s.homepage     = &quot;https://github.com/vhuichen/VCHKit&quot;</span><br><span class="line">s.license      = &quot;MIT&quot;</span><br><span class="line">s.author       = &#123; &quot;vhuichen&quot; =&gt; &quot;vhuichen@163.com&quot; &#125;</span><br><span class="line">s.platform     = :ios, &quot;8.0&quot;</span><br><span class="line">s.source       = &#123; :git =&gt; &quot;https://github.com/vhuichen/VCHKit.git&quot;, :tag =&gt; &quot;#&#123;s.version&#125;&quot; &#125;</span><br><span class="line">s.source_files  = &quot;VCHMapKit/*.&#123;h,m&#125;&quot;, &quot;VCHMapKit/XXXX/*.&#123;h,m&#125;&quot;</span><br><span class="line">s.frameworks = &quot;UIKit&quot;</span><br><span class="line">s.requires_arc = true</span><br></pre></td></tr></table></figure>
<p>*注意：描述description必须填写，并且不能和summary相同</p>
<h3 id="验证pod"><a href="#验证pod" class="headerlink" title="验证pod"></a>验证pod</h3><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">pod lib lint</span><br></pre></td></tr></table></figure>
<p>如果验证成功则会显示成功信息<br>–<strong>VCHMapKit passed validation.</strong></p>
<h2 id="4-提交库到CocoaPods-trunk"><a href="#4-提交库到CocoaPods-trunk" class="headerlink" title="4.提交库到CocoaPods trunk"></a>4.提交库到CocoaPods trunk</h2><h3 id="如果没有注册，则先注册trunk"><a href="#如果没有注册，则先注册trunk" class="headerlink" title="如果没有注册，则先注册trunk"></a>如果没有注册，则先注册trunk</h3><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">pod trunk register vhuichen@163.com &#x27;vhuichen&#x27;  --verbose</span><br></pre></td></tr></table></figure>

<h3 id="向trunk服务器查询自己的注册信息"><a href="#向trunk服务器查询自己的注册信息" class="headerlink" title="向trunk服务器查询自己的注册信息"></a>向trunk服务器查询自己的注册信息</h3><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">pod trunk me</span><br></pre></td></tr></table></figure>

<h3 id="打上和GitHub上相同的tag"><a href="#打上和GitHub上相同的tag" class="headerlink" title="打上和GitHub上相同的tag"></a>打上和GitHub上相同的tag</h3><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">set the new version to 0.0.1</span><br><span class="line">set the new tag to 0.0.1</span><br></pre></td></tr></table></figure>

<h2 id="5-提交代码到GitHub"><a href="#5-提交代码到GitHub" class="headerlink" title="5.提交代码到GitHub"></a>5.提交代码到GitHub</h2><p>将代码提交到GitHub后，再打上tag   </p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">git tag 0.0.1   </span><br><span class="line">git push --tags</span><br></pre></td></tr></table></figure>

<h2 id="6-上传或更新trunk"><a href="#6-上传或更新trunk" class="headerlink" title="6.上传或更新trunk"></a>6.上传或更新trunk</h2><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">pod trunk push</span><br></pre></td></tr></table></figure>

<h2 id="7-出现的问题"><a href="#7-出现的问题" class="headerlink" title="7.出现的问题"></a>7.出现的问题</h2><p><strong>1、Unable to find a pod with name, author, summary, or description matching <code>VCHMapKit</code></strong>	<br>解决方法，先删除缓存，然后在重新搜索</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">rm ~/Library/Caches/CocoaPods/search_index.json</span><br><span class="line">pod search VCHMapKit</span><br></pre></td></tr></table></figure>










    </div>

    
    
    

    <footer class="post-footer">
          <div class="post-tags">
              <a href="/tags/CocoaPods/" rel="tag"># CocoaPods</a>
          </div>

        

          <div class="post-nav">
            <div class="post-nav-item">
                <a href="/2017/05/2017/05/iOS%E5%BC%80%E5%8F%91%E4%B9%8BOC%E9%A1%B9%E7%9B%AE%E6%B7%B7%E7%BC%96Swift%E9%81%87%E5%88%B0%E7%9A%84%E4%B8%80%E4%B8%AA%E5%9D%91/" rel="prev" title="iOS开发之OC项目混编Swift遇到的一个坑">
                  <i class="fa fa-chevron-left"></i> iOS开发之OC项目混编Swift遇到的一个坑
                </a>
            </div>
            <div class="post-nav-item">
                <a href="/2017/07/2017/07/iOS%E5%BC%80%E5%8F%91%E4%B9%8B%E5%88%A4%E6%96%ADView%E6%98%AF%E5%90%A6%E6%98%BE%E7%A4%BA%E5%9C%A8%E5%BD%93%E5%89%8D%E7%AA%97%E5%8F%A3/" rel="next" title="iOS开发之判断View是否显示在当前窗口">
                  iOS开发之判断View是否显示在当前窗口 <i class="fa fa-chevron-right"></i>
                </a>
            </div>
          </div>
    </footer>
  </article>
</div>






</div>
  </main>

  <footer class="footer">
    <div class="footer-inner">


<div class="copyright">
  &copy; 2015 – 
  <span itemprop="copyrightYear">2022</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">vhuichen</span>
</div>
  <div class="powered-by">Powered by <a href="https://hexo.io/" rel="noopener" target="_blank">Hexo</a> & <a href="https://theme-next.js.org/pisces/" rel="noopener" target="_blank">NexT.Pisces</a>
  </div>

    </div>
  </footer>

  
  <script src="https://cdnjs.cloudflare.com/ajax/libs/animejs/3.2.1/anime.min.js" integrity="sha256-XL2inqUJaslATFnHdJOi9GfQ60on8Wx1C2H8DYiN1xY=" crossorigin="anonymous"></script>
<script src="/js/comments.js"></script><script src="/js/utils.js"></script><script src="/js/motion.js"></script><script src="/js/next-boot.js"></script>

  





  





</body>
</html>
